
import React, { useContext, forwardRef } from 'react'
import CustomizeModal, { CustomizeModalButton, CustomizeModalContext } from '@common/presentational/CustomizeModal'
import { Row } from 'antd'
import { deleteCustomerMember } from '@sagas/customer'
import { useDispatch } from 'react-redux'
const DeleteContent = props => {
    const { hide, params } = useContext(CustomizeModalContext)
    const { callback } = props
    const { card_id } = params
    const dispatch = useDispatch()

    const submit = () => {
        dispatch(deleteCustomerMember({
            card_id,
        }, () => {
            callback && callback()
        }))
        hide()
    }

    return (
        <>
            <Row className="modal-line">
                <div className='ft-14 ft-clr-md'>该卡删除后，该卡信息将不存在。</div>
            </Row>
            <CustomizeModalButton
                onOk={submit}
                onCancel={hide}
            />
        </>
    )
}

export default forwardRef((props, ref) => (
    <CustomizeModal width={500} title="是否确定删除？" ref={ref}>
        <DeleteContent {...props} />
    </CustomizeModal>
))
